use icms_dwh
go
create table backuplogs(
courtid uniqueidentifier not null,
date datetime not null
)
drop procedure getReportTest
create procedure getReportTest
@from datetime
as
select top 10 * from cases.cases where CaseRegisteredOn < @from 


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Cases].[CaseCategories](
	[Id_CaseCategories] [uniqueidentifier] NULL CONSTRAINT [DF_CaseCategories_Id_CaseCategories]  DEFAULT (newsequentialid()),
	[Cases_Id] [uniqueidentifier] NULL,
	[CaseTypes_Id] [uniqueidentifier] NULL,
	[DeletedDate] [datetime] NULL
) ON [PRIMARY]


ALTER TABLE Cases.Hearings
ADD HearingSubResultID UNIQUEIDENTIFIER,
HearingMoralDamage DECIMAL(18,2),
HearingMaterialDamage DECIMAL(18,2),
HearingReasonID UNIQUEIDENTIFIER,
HearingPunishmentID UNIQUEIDENTIFIER,
HearingIsDeleted BIT,
HearingStateLanguage BIT

CREATE TABLE [Cases].[HearingsResults]
(
[Id_HearingResult] [uniqueidentifier] NOT NULL CONSTRAINT [DF_HearingsResults_Id_HearingResult] DEFAULT (newsequentialid()),
[HearingResultHearings_Id] [uniqueidentifier] NOT NULL,
[HearingResultPunishmentID] [uniqueidentifier] NULL,
[HearingResultTermSuma] [decimal] (18, 2) NULL,
[HearingResultMeasurementID] [uniqueidentifier] NULL,
[HearingResultParties_Id] [uniqueidentifier] NOT NULL,
[HearingResultSubResultID] [uniqueidentifier] NULL,
[HearingResultIsAllLife] [bit] NULL,
[HearingResultReasonID] [uniqueidentifier] NULL,
[HearingResultFineImposed] [decimal] (18, 2) NULL,
[HearingResultFineCollected] [decimal] (18, 2) NULL,
[HearingResultTermYear] [int] NULL,
[HearingResultTermMonth] [int] NULL,
[HearingResultTermDay] [int] NULL,
[HearingResultTermHour] [int] NULL,
[HearingResultIsAdditional] [bit] NULL CONSTRAINT [DF_HearingsResults_HearingResultIsAdditional] DEFAULT ((0))
)

CREATE TABLE [Cases].[HearingsParties]
(
[HearingPartyHearings_Id] [uniqueidentifier] NOT NULL,
[HearingPartyParties_Id] [uniqueidentifier] NOT NULL
)
